package com.cx.mall.demo.controller;


import com.cx.mall.common.utils.ResponseVO;
import com.cx.mall.demo.model.UserLoginLog;
import com.cx.mall.demo.model.UserLoginLogDTO;
import com.cx.mall.demo.service.IDemoUserLoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/userLoginLog")
public class DemoUserLoginLogController {
    @Autowired
    private IDemoUserLoginLogService userLoginLogService;

    @GetMapping("/getByUserId")
    public ResponseVO queryUserLoginLogByUserId(long userId) {
        List<UserLoginLog> userLoginLogs = userLoginLogService.queryUserLoginLogByUserId(userId);
        return ResponseVO.success(userLoginLogs);
    }

    @GetMapping("/GetByCondition")
    public ResponseVO queryUserLoginLogByCondition(UserLoginLogDTO query) {
        List<UserLoginLog> userLoginLogs = userLoginLogService.queryUserLoginLog(query);
        return ResponseVO.success(userLoginLogs);
    }

}